﻿<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
	<style type="text/css">
		body, html,#allmap {width: 500px;height: 500px;overflow: hidden;margin:0;font-family:"微软雅黑";}
	</style>
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=OYonZmtvxwM2fzf71C3rrZvB&services=&t='+(new Date()).getTime()"></script>
  <script type="text/javascript" src="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.js"></script>
	<link rel="stylesheet" href="/templates/hanmac/css/ditu.css" />
	<title>地址解析</title>
    <style type="text/css">
	body, html{width: 100%;height: 100%;margin:0;font-family:"微软雅黑";}
	#allmap {height: 500px;width:500px;overflow: hidden;}
	#result {width:100%;font-size:10px;}
	dl,dt,dd,ul,li{
		margin:0;
		padding:0;
		list-style:none;
	}
	dt{
		font-size:14px;
		font-family:"微软雅黑";
		font-weight:bold;
		border-bottom:1px dotted #000;
		padding:5px 0 5px 5px;
		margin:5px 0;
	}
	dd{
		padding:5px 0 0 5px;
	}
	li{
		line-height:28px;
	}
	</style>
</head>
<body>
	<div id="allmap"></div>

<script type="text/javascript">
    // 百度地图API功能
    var map = new BMap.Map("allmap");
   // var point = new BMap.Point(116.331398, 39.897445);
    map.centerAndZoom("{model.fields[address]}", 16);
    // 创建地址解析器实例
    map.enableScrollWheelZoom(); //开启滚动缩放
    map.enableContinuousZoom(); //开启缩放平滑
    map.setMapStyle({ style: 'dark' });
    var myGeo = new BMap.Geocoder();
    // 将地址解析结果显示在地图上,并调整地图视野
    myGeo.getPoint("{model.fields[address]}", function (point) {
        if (point) {



            map.centerAndZoom(point, 16);
            map.addOverlay(new BMap.Marker(point));
            var content = '<div style="margin:0;line-height:20px;padding:2px;">' +
                    '<img src="./templates/hanmac/img/shoppic.jpg" alt="" style="float:right;zoom:1;overflow:hidden;width:140px;height:100px;margin-left:3px;"/>' +
                     '地址：{model.fields[address]}<br/>电话：{model.fields[tel]}<br/>营业时间：{model.fields[openingtime]}' +
                  '</div>';

            //创建检索信息窗口对象
            var searchInfoWindow = null;
            searchInfoWindow = new BMapLib.SearchInfoWindow(map, content, {
                title: "{model.title}",      //标题
                width: 290,             //宽度
                height: 105,              //高度
                panel: "panel",         //检索结果面板
                enableAutoPan: true,     //自动平移
                searchTypes: [
                BMAPLIB_TAB_TO_HERE,  //到这里去
				BMAPLIB_TAB_SEARCH,   //周边检索
				
				BMAPLIB_TAB_FROM_HERE //从这里出发
			]
            });

            searchInfoWindow.open(new BMap.Marker(point));

        }
    }, "{model.fields[diqu]}");
</script>
</body>
</html>